sock_async: fix cyclic include problem#12921
Conversation
|
@kaspar030 can you have a look please. This somewhat breaks the "one header for everything" idea we had in #11723, but I don't really see another way to resolve the cyclic dependencies. |
|
LLVM doesn't like re-definitions of types :-(. Any idea how to solve this, or should we just deactivate that warning? |
I do not get the warning when compiling for the sections with the redefinitions? |
If you tried the most current version of this PR, this does not surprise me... see my changes to |
|
@fjmolinas you have to revert the last commit to get the effect I was describing. |
I had removed |
@miri64 I tried to look into the discussion in #11723 and to me it seems the idea was to keep the changes restricted and not mix into existing headers. To me adding the |
I think @kaspar030 and I discussed this mostly offline, so its not surprising to not have it there. Basically we wanted to isolate |
BTW you have to build for a board (e.g. for |
|
Used |
AHA! that was it, thanks! Test is still passing. RIOT_CI_BUILD=1 BUILD_IN_DOCKER=1 TOOLCHAIN=llvm BOARD=iotlab-m3 make -C |
fjmolinas
left a comment
There was a problem hiding this comment.
Test is still working, usage has been explained. Ignoring typdef redefinition has been limited to the async files and the sock files. I don't think there is another way around this issue.
AFAIKT the single file approach to contain async code is still respected.
@kaspar030 might want to take another look, but otherwise ACK on my side. feel free to squash.
|
May I squash? |
Yes. |
Typically a stack needs to add the callback for a sock as a member of its respective `sock` type so `sock_types.h` needs to include `net/sock/async.h` at the moment. As those however include `net/sock/<prot>.h`, which in turn include `sock_types.h`, we create a cyclic dependency. This fix resolves this cyclic dependency, by putting the callback definitions in its own header that then in turn can be also included by `sock_types.h`.
net/sock/async/types.h included by net/sock.h needs to re-typedef the the sock types to prevent cyclic includes.
180e613 to
3896145
Compare
|
Done. |
|
GO! |
Contribution description
Typically a stack needs to add the callback for a sock as a member of its respective
socktype sosock_types.hneeds to includenet/sock/async.hat the moment. As those however includenet/sock/<prot>.h, which in turn includesock_types.h, we create a cyclic dependency.This fix resolves this cyclic dependency, by putting the callback definitions in its own header that then in turn can be also included by
sock_types.h.Testing procedure
tests/gnrc_sock_asyncshould still work and runmake -C tests/gnrc_sock_async flash testIssues/PRs references
Required for #12601, #12602, and #12907 to work.